using System.Collections.Generic;
using FibMatrix.Task;

namespace FibMatrix
{
	/// <summary>
	/// @note 废弃了，在创建AssetBundleLoadItem时会立即展开依赖
	/// 从直接依赖算出全部依赖
	/// </summary>
	[FM_Mono.IgnoreGen]
	public class FlatBundleDependencePipe : IResourceLoadPipe
	{
		public FMTask Handle(IResourcePipelineContext rawContext, out ResourceError error)
		{
			error = ResourceError.None;
			ResourcePipelineContext context = rawContext as ResourcePipelineContext;
			AssetBundleLoadItem mainHint = context.item as AssetBundleLoadItem;
			List<BundleInfo> dependence = mainHint.bundleInfo.dependence;

			if (mainHint.bundleInfo.flatDependence == null && dependence != null && dependence.Count > 0)
			{
				mainHint.bundleInfo.flatDependence = ResourceHelper.ProcessLoadDependence(mainHint.bundleInfo);
			}
			return null;
		}
	}
}